<loading></loading>
<!-- navbar -->
<div data-ng-include=" 'tpl/blocks/header.html' " class="app-header navbar">
</div>
<!-- / navbar -->

<!-- menu -->
<div data-ng-include=" 'tpl/blocks/aside.html' " class="app-aside hidden-xs {{app.settings.asideColor}}">
</div>
<!-- / menu -->

<!-- content -->
<div class="app-content">
    <div ui-butterbar></div>
    <a href class="off-screen-toggle hide" ui-toggle-class="off-screen" data-target=".app-aside" ></a>
    <div class="app-content-body fade-in-up" ui-view></div>
</div>
<!-- /content -->

<!-- aside right -->
<!--<div class="app-aside-right pos-fix no-padder w-md w-auto-xs bg-white b-l animated fadeInRight hide">-->
<!--<div class="vbox">-->
<!--<div class="wrapper b-b b-t b-light m-b">-->
<!--<a href class="pull-right text-muted text-md" ui-toggle-class="show" target=".app-aside-right"><i class="icon-close"></i></a>-->
<!--Chat-->
<!--</div>-->
<!--<div class="row-row">-->
<!--<div class="cell">-->
<!--<div class="cell-inner padder">-->
<!--&lt;!&ndash; chat list &ndash;&gt;-->
<!--<div class="m-b">-->
<!--<a href class="pull-left thumb-xs avatar"><img src="img/a2.jpg" alt="..."></a>-->
<!--<div class="clear">-->
<!--<div class="pos-rlt wrapper-sm b b-light r m-l-sm">-->
<!--<span class="arrow left pull-up"></span>-->
<!--<p class="m-b-none">Hi John, What's up...</p>-->
<!--</div>-->
<!--<small class="text-muted m-l-sm"><i class="fa fa-ok text-success"></i> 2 minutes ago</small>-->
<!--</div>-->
<!--</div>-->
<!--<div class="m-b">-->
<!--<a href class="pull-right thumb-xs avatar"><img src="img/a3.jpg" class="img-circle" alt="..."></a>-->
<!--<div class="clear">-->
<!--<div class="pos-rlt wrapper-sm bg-light r m-r-sm">-->
<!--<span class="arrow right pull-up arrow-light"></span>-->
<!--<p class="m-b-none">Lorem ipsum dolor :)</p>-->
<!--</div>-->
<!--<small class="text-muted">1 minutes ago</small>-->
<!--</div>-->
<!--</div>-->
<!--<div class="m-b">-->
<!--<a href class="pull-left thumb-xs avatar"><img src="img/a2.jpg" alt="..."></a>-->
<!--<div class="clear">-->
<!--<div class="pos-rlt wrapper-sm b b-light r m-l-sm">-->
<!--<span class="arrow left pull-up"></span>-->
<!--<p class="m-b-none">Great!</p>-->
<!--</div>-->
<!--<small class="text-muted m-l-sm"><i class="fa fa-ok text-success"></i>Just Now</small>-->
<!--</div>-->
<!--</div>-->
<!--&lt;!&ndash; / chat list &ndash;&gt;-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!--<div class="wrapper m-t b-t b-light">-->
<!--<form class="m-b-none">-->
<!--<div class="input-group">-->
<!--<input type="text" class="form-control" placeholder="Say something">-->
<!--<span class="input-group-btn">-->
<!--<button class="btn btn-default" type="button">SEND</button>-->
<!--</span>-->
<!--</div>-->
<!--</form>-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!-- / aside right -->

<!-- footer -->
<div class="app-footer wrapper b-t bg-light  hidden-xs">
    <span class="pull-right">{{app.version}} <a href ui-scroll="app" class="m-l-sm text-muted"><i class="fa fa-long-arrow-up"></i></a></span>
    中伟钢物联发展有限公司 版权所有 豫ICP备14027827号 增值电信业务经营许可证：豫B2-20150034
</div>
<!-- / footer -->
<!-- / hanyu -->
<div class="tab-content">
    <div id="bottom-cons">

    </div>
    <div id="bottom-view" class="bottom-view">
    </div>
</div>
<div id="phone-tab" class="app-footer  visible-xs row bottom-con" style="border-top: 1px #a0a1a2 solid;background-color: white;    border-top: 1px #a0a1a2 solid;
                                                                        z-index: 100;
                                                                        position: fixed;">
</div>

<script>
    var allFun = [
        // {
        //   id:'0',
        //   title:'最近使用',
        //   hrf:'#',
        //   numID:'',
        //   img:'/htm/img/tab-selUser.png',
        //   values:[
        //      {
        //           id:'0',
        //           title:'客户列表',
        //           hrf:'app.InfoCollection_List',
        //           img:'/htm/img/tab-user.png',
        //           selImg:'/htm/img/tab-selUser.png',
        //       },
        //         {
        //           id:'1',
        //           title:'客户账',
        //           hrf:'app.Purchasing_MyPurList',
        //           img:'/htm/img/tab-zd.png',
        //           selImg:'/htm/img/user-selZd.png',
        //       },
        //   ]
        // },
        {
            id:'0',
            title:'系统管理',
            hrf:'',
            numID:'A',
            img:'/htm/img/tab-selUser.png',
            values:[
                {
                    id:'0',
                    title:'员工管理',
                    hrf:'app.Employee_List',
                    img:'/htm/img/tab-user.png',
                    selImg:'/htm/img/tab-selUser.png',
                }
            ]
        },
        {
            id:'1',
            title:'客户管理',
            hrf:'',
            numID:'5',
            img:'/htm/img/tab-selUser.png',
            values:[
                {
                    id:'1',
                    title:'客户列表',
                    hrf:'app.Customer_List',
                    img:'/htm/img/tab-zd.png',
                    selImg:'/htm/img/user-selZd.png',
                },
                {
                    id:'2',
                    title:'报备申请',
                    hrf:'app.Customer_ConfirmList',
                    img:'/htm/img/tab-zd.png',
                    selImg:'/htm/img/user-selZd.png',
                }
            ]
        },
        {
            id:'2',
            title:'供应商及钢厂',
            hrf:'',
            numID:'2',
            img:'/htm/img/tab-selUser.png',
            values:[
                {
                    id:'0',
                    title:'供应商及钢厂',
                    hrf:'app.InfoCollection_List',
                    img:'/htm/img/tab-user.png',
                    selImg:'/htm/img/tab-selUser.png',
                },
                {
                    id:'1',
                    title:'供应商',
                    hrf:'app.Provider_List',
                    img:'/htm/img/tab-zd.png',
                    selImg:'/htm/img/user-selZd.png',
                },
                {
                    id:'2',
                    title:'品牌',
                    hrf:'app.Supplier_List',
                    img:'/htm/img/tab-zd.png',
                    selImg:'/htm/img/user-selZd.png',
                },
            ]
        },
        {
            id:'3',
            title:'计划单管理',
            hrf:'',
            numID:'2',
            img:'/htm/img/tab-selUser.png',
            values:[
                {
                    id:'0',
                    title:'计划单',
                    hrf:'app.Order_orderList',
                    img:'/htm/img/tab-user.png',
                    selImg:'/htm/img/tab-selUser.png',
                },
                {
                    id:'1',
                    title:'锁价单',
                    hrf:'app.LockOrder_List',
                    img:'/htm/img/tab-zd.png',
                    selImg:'/htm/img/user-selZd.png',
                }
            ]
        },
        {
            id:'4',
            title:'报表管理',
            hrf:'',
            numID:'2',
            img:'/htm/img/tab-selUser.png',
            values:[
                {
                    id:'0',
                    title:'采购明细报表',
                    hrf:'app.Report_Purchase',
                    img:'/htm/img/tab-user.png',
                    selImg:'/htm/img/tab-selUser.png',
                }
            ]
        },
        {
            id:'5',
            title:'采购单管理',
            hrf:'', 
            numID:'7',
            img:'/htm/img/tab-selUser.png',
            values:[
                {
                    id:'0',
                    title:'采购单',
                    hrf:'app.Purchasing_List',
                    img:'/htm/img/tab-user.png',
                    selImg:'/htm/img/tab-selUser.png',
                }
            ]
        },
        {
            id:'6',
            title:'审批管理',
            hrf:'',
            numID:'A',
            img:'/htm/img/tab-selUser.png',
            values:[
                {
                    id:'0',
                    title:'审批异常处理',
                    hrf:'app.Approval_AdmIndex',
                    img:'/htm/img/tab-user.png',
                    selImg:'/htm/img/tab-selUser.png',
                },
                {
                    id:'1',
                    title:'流程管理',
                    hrf:'app.Approval_Manage',
                    img:'/htm/img/tab-user.png',
                    selImg:'/htm/img/tab-selUser.png',
                }
            ]
        },
        {
            id:'7',
            title:'财务',
            hrf:'',
            numID:'4',
            img:'/htm/img/tab-selUser.png',
            values:[
                {
                    id:'0',
                    title:'款项管理',
                    hrf:'app.Finance_PayInfoList',
                    img:'/htm/img/tab-user.png',
                    selImg:'/htm/img/tab-selUser.png',
                },
                {
                    id:'1',
                    title:'客户帐',
                    hrf:'app.Finance_AccountList',
                    img:'/htm/img/tab-user.png',
                    selImg:'/htm/img/tab-selUser.png',
                }
            ]
        },
        {
            id:'8',
            title:'审批',
            hrf:'',
            numID:'3',
            img:'/htm/img/tab-selUser.png',
            values:[
                {
                    id:'0',
                    title:'审批列表',
                    hrf:'app.Approval_Index',
                    img:'/htm/img/tab-user.png',
                    selImg:'/htm/img/tab-selUser.png',
                }
            ]
        },
    ]
    var  otherFun =  {
        id:'9',
        title:'其余',
        hrf:'',
        numID:'100',
        img:'/htm/img/tab-selUser.png',
        values:[
            {
                id:'0',
                title:'报价资讯',
                numID:'1',
                hrf:'app.Information_InformationList',
                img:'/htm/img/tab-user.png',
                selImg:'/htm/img/tab-selUser.png',
            },{
                id:'1',
                title:'驻厂计划单',
                numID:'6',
                hrf:'app.FieldMan_FieldManList',
                img:'/htm/img/tab-user.png',
                selImg:'/htm/img/tab-selUser.png',
            },{
                id:'2',
                title:'消息',
                numID:'',
                hrf:'app.News_news',
                img:'/htm/img/tab-user.png',
                selImg:'/htm/img/tab-selUser.png',
            },{
                id:'3',
                title:'我的客户',
                numID:'1',
                hrf:'app.Customer_SelfList',
                img:'/htm/img/tab-user.png',
                selImg:'/htm/img/tab-selUser.png',
            },{
                id:'4',
                title:'计划单',
                numID:'1',
                hrf:'app.Order_MyorderList',
                img:'/htm/img/tab-user.png',
                selImg:'/htm/img/tab-selUser.png',
            },{
                id:'5',
                title:'锁价单',
                numID:'1',
                hrf:'app.MyLockOrder_List',
                img:'/htm/img/tab-user.png',
                selImg:'/htm/img/tab-selUser.png',
            },{
                id:'6',
                title:'采购单',
                numID:'7',
                hrf:'app.Purchasing_MyPurList',
                img:'/htm/img/tab-user.png',
                selImg:'/htm/img/tab-selUser.png',
            },{
                id:'7',
                title:'报款',
                numID:'1',
                hrf:'app.ClientManager_PaymentInfoList',
                img:'/htm/img/tab-user.png',
                selImg:'/htm/img/tab-selUser.png',
            },{
                id:'8',
                title:'钢厂信息收集',
                numID:'6',
                hrf:'app.InfoCollection_List',
                img:'/htm/img/tab-user.png',
                selImg:'/htm/img/tab-selUser.png',
            }
        ]
    }
    var allFunItem ={
        id:'3',
        title:'全部应用',
        hrf:'#bottom-con',
        img:'/htm/img/tab-allFun.png',
        selImg:'/htm/img/tab-selAllFun.png',
    }
    var  bottomW = '100%'
    var ID = ''
    var  sumItemsArr = []
    // 底部tab .
    $(function(){
        $("#bottom-view").hide();
        var allItems = []
        //所有应用中的icon,过滤符合用户权限的数组
        var arrIcon = []
        for (var index = 0; index < allFun.length; index++) {
            var item = allFun[index];
            if(window.Jurisdiction.indexOf(item.numID) >=0 || item.numID == '' ){
                arrIcon.push(item)
            }
        }
        allFun = arrIcon
        console.log(arrIcon)

        var lastArrIcon = []
        for (var index = 0; index < otherFun.values.length; index++) {
            var item =  otherFun.values[index];
                if(window.Jurisdiction.indexOf(item.numID) >=0 || item.numID == ''){
                    console.log('ssdfsdf')
                    lastArrIcon.push(item)

                }
        }

        otherFun.values = lastArrIcon
        allFun.push(otherFun)

        //提取所有功能
        for (var index = 0; index < allFun.length; index++) {
            var funItem = allFun[index];
            allItems =  allItems.concat(funItem.values)
        }
        for (var index = 0; index < allItems.length; index++) {
            var item = allItems[index];
            item.id = index
        }
        if(allItems.length <4){
            bottomW = 100/allItems.length + '%'
            sumItemsArr = allItems
            tabsIcon(allItems)
        }else{
            //前三个数组
            bottomW = '25%'
            beforeItems = allItems.slice(0,3)
            beforeItems.push(allFunItem)
            sumItemsArr = beforeItems
            tabsIcon(beforeItems)
            allFuns(allFun)
        }
    });
    //所有应用中的icon
    function allFuns  (allFun){
        // 所有应用
        for (var index = 0; index < allFun.length; index++) {
            var data = allFun[index];
            allFunMidArr = []
            creatAllFun = "<div style='padding-top:15px;clear: both;'><p><div class='bottom-fun'></div><p style='margin-left:10px'>"+data.title+"</p></p>"
            $('#bottom-view').append($($.parseHTML(creatAllFun)))
            // 每一类中的item
            for (var i = 0; i <  data.values.length; i++) {
                var item =  data.values[i];
                item.state = false
              
                allFunMid = "<a onclick='onItem()' ui-sref= '"+item.hrf+"'  class='bottom-tab' style='width:"+bottomW+";'><p><img src='"+item.img+"' style='width:20px'></p><p style='color:black'>"+item.title+"</p></a>"
                $('#bottom-view').append($($.parseHTML(allFunMid)))
            }
            allFunViewEnd = "</div>"
            $('#bottom-view').append($($.parseHTML(allFunViewEnd)))
        }
    }
    function tabsIcon (data){
        for (var i = 0; i <  data.length; i++) {
            var item =  data[i];
            if(item.hrf.indexOf("bottom-con") >= 0){
                creatView = "<a  onclick='onTab("+item.id+")'  data-toggle='tab'  class='bottom-tab' style='width:"+bottomW+";'><p style='margin: 5px 0 5px;'><img id='"+'tab-img'+item.id+"' style='width:20px;height:20px' src='"+item.img+"'></span></p><p style='margin-bottom: 0px' id='"+'tab-title'+item.id+"'>"+item.title+"</p></a>"
              
            }else{
                creatView = "<a  onclick='onTab("+item.id+")' data-toggle='tab' ui-sref= '"+item.hrf+"'  class='bottom-tab' style='width:"+bottomW+";'><p style='margin: 5px 0 5px;'><img id='"+'tab-img'+item.id+"' style='width:20px;height:20px' src='"+item.img+"'></span></p><p style='margin-bottom: 0px' id='"+'tab-title'+item.id+"'>"+item.title+"</p></a>"
            }
            bottonCon = "<div class='tab-pane fade visible-xs'></div>"
            $('#bottom-cons').append($($.parseHTML(bottonCon)));
            $('#phone-tab').append($($.parseHTML(creatView)));
        }
    }
    function onItem (){
        $("#bottom-view").hide();
    }
    function onTab  (id){
        if(id === ID && id != 3){
            return
        }
        if(id != 3){
            $("#bottom-view").hide();
        }else{
            $("#bottom-view").show();
        }
        var data = sumItemsArr
        data[id].state = !data[id].state
        document.getElementById('tab-img'+id).src= data[id].state ?  data[id].selImg : data[id].img ;
        document.getElementById('tab-title'+id).style.color= data[id].state   ?  '#169CE1' : '#C8C8C8' ;
        if(ID == id && id == 3){
            document.getElementById('tab-img'+id).src=data[id].selImg ;
            document.getElementById('tab-title'+id).style.color=  '#169CE1' ;
        }
        for (var i = 0; i <  data.length; i++) {
            var item =  data[i];
            if(item.id != id){
                item.state = false
                document.getElementById('tab-img'+i).src= data[i].img ;
                document.getElementById('tab-title'+i).style.color=  '#C8C8C8' ;
            }
        }

        ID = id
    }

</script>
<style>
    .bottom-con{
        width: 100%;
        margin: 0;
    }
    .bottom-tab{
        z-index: 10;
        height:55px;
        float:left;
        text-align:center;
        color:#c8c8c8;
    }
    .bottom-tab a:hover, a:focus{
        color:#169ce1
    }
    .bottom-fun{
        width:5px;
        height:20px;
        background:#169ce1;
        float:left;
    }
    .bottom-view{
        height: 100%;
        width:100%;
        background: #f0f3f4;
        padding:40px 10px 80px;
        position: fixed;
        top: 0;
        overflow-y: scroll;
    }

</style>
<!--<div data-ng-include=" 'tpl/blocks/settings.html' " class="settings panel panel-default">-->
<!--</div>-->